package com.example.cdpbookstore.web.servlet;


import com.example.cdpbookstore.service.OrderService;
import com.example.cdpbookstore.service.impl.OrderServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/cancel-order")
public class CancelOrderServlet extends HttpServlet {


    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        if (id != null) {
            OrderService orderService = new OrderServiceImpl();
            orderService.cancelOrder(id);
        }
        response.sendRedirect("order.jsp");
    }

}
